package 笔试题;

public class lk_1017 {
    public static void main(String[] args) {
        System.out.println(baseNeg2(3));
    }
    public static String baseNeg2(int n) {

        StringBuilder sb = new StringBuilder();
        boolean b = true;
        int z = 0;
        do{
            z=n&1;
            sb.append(z);
            n>>=1;
            if(!b){
                n+=z;
            }
            b = !b;
        }while (n>0);

        return sb.reverse().toString();
    }

}
